package cn.cloudplug.instar_ec.accessional.picture;

import android.content.Context;

import java.util.ArrayList;
import java.util.List;

import cn.cloudplug.ui.view.ScaleImageView;

/**
 * Created by pc on 2018/1/24.
 */

public class PicControlMode {
    public static final int MODEL_DELETE = 1;
    public static final int MODEL_DEFAULT = 0;

    private int mode = 0;
    private List<OnChangeModeListener> onChangeModeListenerList = new ArrayList<>();
    private ScaleImageView scaleImageView;

    public PicControlMode(Context context) {
        scaleImageView=new ScaleImageView(context);
    }

    public ScaleImageView getScaleImageView() {
        return scaleImageView;
    }

    public void setMode(int mode){
        boolean change=this.mode!=mode;
        this.mode=mode;
        if(change)
        for (OnChangeModeListener modeListener : onChangeModeListenerList) {
            if(modeListener!=null)
            modeListener.onChangeModeListener(mode);
        }
    }

    public int getMode() {
        return mode;
    }

    public void addOnChangeModeListener(OnChangeModeListener onChangeModeListener){
        onChangeModeListenerList.add(onChangeModeListener);
    }

    interface OnChangeModeListener{
        void onChangeModeListener(int mode);
    }
}
